![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@pirxpilot/google-polyline
Advanced tools
Encodes and decodes Google's polyline format It's a forked version of google-polyline module with minor performance improvements and reversed order of coordinates: longitude, latitude (think x, y or easting, northing), which corresponds to position definition in GeoJSON spec.
$ npm install --save google-polyline
var polyline = require( 'google-polyline' )
polyline.encode([
[ -120.2, 38.5 ],
[ -120.95, 40.7 ],
[ -126.453, 43.252 ]
])
> '_p~iF~ps|U_ulLnnqC_mqNvxq`@'
polyline.decode( '_p~iF~ps|U_ulLnnqC_mqNvxq`@' )
> [
[ -120.2, 38.5 ],
[ -120.95, 40.7 ],
[ -126.453, 43.252 ]
]
polyline.encode(points[, mapFunction])
returns string representing encoded polyline
points
is an array of points, each point is a 2 element array [longitude, latitude]mapFunction
- can be optionally passed to convert array of elements to [lon. lat] pairs
mapFunction is called for each item in points
array and has the same signature as Array.map
callbackpolyline.decode(string[, factor][, mapFunction])
returns array of point representing decoded polyline
string
is an encoded polyline representationfactor
- optional (defaults to 1e5
), factor by which coordinates are divided after decoding; use factor 1e6
when decoding polylines from OSM data (OSRM, mapzen etc.)mapFunction
- optional - if provided it'll be called for each [lon. lat] pair to convert the point
before it is added to resulting points
arrayFAQs
Encode / decode Google's polyline format
We found that @pirxpilot/google-polyline demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.